#!/usr/bin/python

import os
import string
import tarfile
import shutil

os.makedirs( 'moos_gumstix' );

shutil.copytree( 'moos', 'moos_gumstix/moos' );
shutil.copy( 'moos.bb', 'moos_gumstix/moos.bb' );
shutil.copytree( 'essentials', 'moos_gumstix/essentials' );
shutil.copy( 'essentials.bb', 'moos_gumstix/essentials.bb' );

#Open the version file
f = open('VERSION');

#Read in the version
VERSION = f.read();

#Strip the line ending
VERSION_NUMERIC = string.strip( VERSION, '\n');

#Create the version name
VERSION_NAME = 'moos_gumstix_' + VERSION_NUMERIC + '.tgz';

RELEASE = tarfile.open( VERSION_NAME, "w:gz" );

RELEASE.add( 'moos_gumstix' );

shutil.rmtree( 'moos_gumstix' );

RELEASE.close();
